<template>
    <div class="login-form">
        <el-form ref="form" label-width="80px">
            <el-form-item label="手机">
                <el-input v-model="name"></el-input>
            </el-form-item>
            <el-form-item label="密码">
                <el-input type="password" v-model="password"></el-input>
            </el-form-item>
            <el-form-item >
                <el-button  type="primary" @click="onLogin">登录</el-button>
            </el-form-item>
        </el-form>
    </div>
</template>

<script>
    import {loginApi} from '../api'

    export default {
        data() {
            return {
                name: '',
                password: ''
            };
        },
        methods: {
            onLogin() {
                loginApi.login(this.name, this.password);
                this.$router.push('/dashboard');
            }
        }
    }
</script>

<style scoped lang="postcss">
    @import "../assets/css/mixins.postcss";

    .login-form{
        width: 100%;
        height: 100vh;
        position: relative;

        form{
            @add-mixin middle-center;
        }
    }
</style>
